package com.gsafety.libraryktx.expand

import android.content.res.Resources
import android.util.TypedValue
import com.gsafety.library.Utils.ByteArrayUtil

inline fun Float.toByteArray() = ByteArrayUtil.float2ByteArray(this)

inline fun Float.dp(): Float
{
    return TypedValue.applyDimension(
        TypedValue.COMPLEX_UNIT_DIP,
        this,
        Resources.getSystem().displayMetrics
    )
}

inline fun Float.sp(): Float
{
    return TypedValue.applyDimension(
        TypedValue.COMPLEX_UNIT_SP,
        this,
        Resources.getSystem().displayMetrics
    )
}